package com.qianxx.component.activity.chart.grid_chart;

import android.graphics.Color;
import android.os.Bundle;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.viewlibrary.chart.axis.Axis;
import com.qianxx.viewlibrary.chart.view.GridChart;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class GridChartActivity extends BaseActivity {
    @BindView(R.id.grid_chart)
    GridChart grid_chart;

    List<String> ytitle = new ArrayList<>();
    List<String> xtitle = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_grid_chart);
        ButterKnife.bind(this);

        initData();
        initView();
    }

    private void initView() {
        grid_chart.setAxisXColor(Color.LTGRAY);
        grid_chart.setAxisYColor(Color.LTGRAY);
        grid_chart.setBorderColor(Color.LTGRAY);
        grid_chart.setLatitudeNum(5);
        grid_chart.setLongitudeNum(6);
        grid_chart.setDataQuadrantPaddingTop(5);
        grid_chart.setDataQuadrantPaddingBottom(5);
        grid_chart.setDataQuadrantPaddingLeft(5);
        grid_chart.setDataQuadrantPaddingRight(5);
        grid_chart.setAxisXPosition(Axis.AXIS_X_POSITION_BOTTOM);
        grid_chart.setAxisYPosition(Axis.AXIS_Y_POSITION_LEFT);
        grid_chart.getSimpleGrid().setLatitudeTitles(ytitle);
        grid_chart.getSimpleGrid().setLongitudeTitles(xtitle);
        grid_chart.setLongitudeFontSize(14);
        grid_chart.setLatitudeFontSize(14);
        grid_chart.setLongitudeFontColor(Color.BLACK);
        grid_chart.setLatitudeColor(Color.GRAY);
        grid_chart.setLatitudeFontColor(Color.BLACK);
        grid_chart.setLongitudeColor(Color.GRAY);
        grid_chart.setDisplayLongitudeTitle(true);
        grid_chart.setDisplayLatitudeTitle(true);
        grid_chart.setDisplayLatitude(true);
        grid_chart.setDisplayLongitude(true);
        grid_chart.setDisplayBorder(false);
        grid_chart.setCrossLinesColor(Color.BLACK);
        grid_chart.setCrossLinesFontColor(Color.BLACK);
        grid_chart.setBorderWidth(1);
    }


    private void initData() {

        ytitle.add("241");
        ytitle.add("242");
        ytitle.add("243");
        ytitle.add("244");
        ytitle.add("245");

        xtitle.add("9:00");
        xtitle.add("10:00");
        xtitle.add("11:00");
        xtitle.add("13:00");
        xtitle.add("14:00");
        xtitle.add("15:00");
    }

    @Override
    public String setTitle() {
        return "GridChart";
    }
}
